package web.demo.entity;

public class OrderDetail {
	private int id;
	private int food_id;
	private String food_name;
	private double food_price;
	private double food_countMoney;
	private int orders_id;
	private int food_count;
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof OrderDetail){
			obj=(OrderDetail)obj;
			if(((OrderDetail) obj).getId()==this.id){
				if(((OrderDetail) obj).getFood_id()==this.food_id && this.food_id!=0){
					return true;
				}else{
					return false;
				}
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	
	public String getFood_name() {
		return food_name;
	}
	public void setFood_name(String food_name) {
		this.food_name = food_name;
	}
	public double getFood_price() {
		return food_price;
	}
	public void setFood_price(double food_price) {
		this.food_price = food_price;
	}
	public double getFood_countMoney() {
		if(this.food_count>0){
			return this.food_count*this.food_price;
		}else{
			return food_countMoney;
		}
	}
	public void setFood_countMoney(double food_countMoney) {
		this.food_countMoney = food_countMoney;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getId() {
		return id;
	}
	public int getFood_id() {
		return food_id;
	}
	public void setFood_id(int food_id) {
		this.food_id = food_id;
	}
	public int getOrders_id() {
		return orders_id;
	}
	public void setOrders_id(int orders_id) {
		this.orders_id = orders_id;
	}
	public int getFood_count() {
		return food_count;
	}
	public void setFood_count(int food_count) {
		this.food_count = food_count;
	}
	@Override
	public String toString() {
		return "OrderDetail [id=" + id + ", food_id=" + food_id
				+ ", food_name=" + food_name + ", food_price=" + food_price
				+ ", food_countMoney=" + food_countMoney + ", orders_id="
				+ orders_id + ", food_count=" + food_count + "]";
	}
	
}
